package cn.webestar.scms.user.api.dto.Role;

import cn.webestar.scms.commons.api.UpdateBody;
import cn.webestar.scms.user.entity.Role;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.util.Date;
import java.util.Set;

@Data
@Schema(description = "RoleUpdateDTO")
public class RoleUpdateDTO extends UpdateBody {

    private Long id;

    @Schema(description = "cid")
    private Long cid;

    @Schema(description = "名称")
    private String name;

    @Schema(description = "备注")
    private String remark;

    @Schema(description = "权限资源")
    private Set<Long> resourceIds;

    @Schema(description = "创建人")
    private Long creator;

    @Schema(description = "更新人")
    private Long updater;

    @Schema(description = "创建时间")
    private Date createTime;

    @Schema(description = "更新时间")
    private Date updateTime;

    @Schema(description = "是否可用")
    private Boolean isEnable;

    @Override
    public Long getId() {
        return id;
    }

    @Override
    public Role toDO() {
        Role o = new Role();
        o.setId(id);
        o.setCid(cid);
        o.setName(name);
        o.setRemark(remark);
        o.setResourceIds(resourceIds);
        o.setCreator(creator);
        o.setUpdater(updater);
        o.setCreateTime(createTime);
        o.setUpdateTime(updateTime);
        o.setIsEnable(isEnable);
        return o;
    }

}
